- /* scfsinbs.cpp by K.Tsuru */
- // function ID = 9122 since ver.2.18
- /*****************************************
- SComplex class
- It returns cos(z) using binary splitting method.
- Let z = x+iy,
- sin(z) = sin(x)*cosh(y)+i*cos(x)sinh(y).
- *****************************************/
- #ifndef SN_H
- #include "sn.h"
- #endif
- SComplex CsinBS(const SComplex& z){
- SDouble c, s, ch, sh;
- CosSinBS(z.Real(), c, s); // c = cos(x), s = sin(x)
- SDouble e, r;
- int is = z.Imag().Sign(9122);
-
- if(is > 0) { // y > 0
- e = ExpBS(z.Imag()); // = exp(y)
- r = 1/e;
- ch = DDiv2(e + r); // = cosh(y)
- sh = ch - r; // = sinh(y)
- } else if(is == 0) { // y = 0
- ch = 1; sh = 0.0;
- } else { // y < 0
- e = ExpBS(-z.Imag()); // = exp(-y)
- r = 1/e;
- ch = DDiv2(e + r); // = cosh(-y)
- sh = ch - e; // = -sinh(-y)
- }
- return SComplex(s * ch, c * sh);
- }
scfsinbs.cpp : last modifiled at 2008/12/08 16:22:14(862 bytes)
created at 2017/10/06 15:21:28
The creation time of this html file is 2017/10/06 15:27:09 (Fri Oct 06 15:27:09 2017).